import http from './index'
import user from '@/common/userinfo.js'

// 封装轮播图接口
export const getBanner = () => http({
	url: '/getbanner'
})

// 首页快速导航分类
export const getHomeCate = () => http({
	url: '/getcate'
})

// 首页商品信息
export const getHomeGoods = () => http({
	url: '/gethortgoods'
})

// 分类页一级二级
export const getCates = () => http({
	url: '/getcates'
})

// 列表页接口
export const getGoodList = data => http({
	url: '/getgoodlist',
	data
})

// 商品详情页接口
export const getGoodsInfo = data => http({
	url: '/getgoodsinfo',
	data
})

// 封装一个验证码接口
export const sendSms = (data) => http({
	url: '/sms',
	data
})

// 封装一个手机号验证接口
export const smsLogin = (data) => http({
	url: '/smslogin',
	method: 'post',
	data
})

//封装一个一键登录
export const wxLogin = data => http({
	url: '/wxlogin',
	method: 'post',
	data
})


// 购物车添加
export const cartAdd = (data, header) => http({
	url: '/cartadd',
	method: 'post',
	header: {
		"authorization": user.token
	},
	data
})

// 购物车列表
export const cartList = (data, header) => http({
	url: '/cartlist',
	header: {
		"authorization": user.token
	},
	data
})

// 购物车删除
export const cartDelete = (data, header) => http({
	url: '/cartdelete',
	method: 'post',
	header: {
		"authorization": user.token
	},
	data
})

// 购物车增加，减少
export const addCart = (data, header) => http({
	url: '/cartedit',
	method: 'post',
	header: {
		"authorization": user.token
	},
	data
})


// 订单生成接口
export const Indent = (data,header) => http({
	url:'/orderadd',
	methods:'post',
	header:{
		"content-Type":'application/json',
		"authorization":user.token
	},
	data
})


// 地址添加接口
export const Addressadd = (data,header) => http({
	url:'/addressadd',
	method:'post',
	header:{
		"content-Type":'application/json',
		"authorization":user.token
	},
	data
})

// 地址查询接口
export const Addresslist = (data,header) => http({
	url:'/addresslist',
	header:{
		"content-Type":'application/json',
		"authorization":user.token
	},
	data
})

// 地址删除接口
export const AddRessRemove = (data,header) => http({
	url:'/addressremove',
	method:'post',
	header:{
		"content-Type":'application/json',
		"authorization":user.token
	},
	data
})

// 地址编辑接口
export const Addressedit = (data,header) =>http({
	url:'/addressedit',
	method:'post',
	header:{
		"content-Type":'application/json',
		"authorization":user.token
	},
	data
})